﻿using System;
using System.Collections.Generic;

namespace IInject.Registration
{
	public class DefaultContextRegistry : RegistryBase<RegistryContext>
	{
		public DefaultContextRegistry(IContainer container) : base(container)
		{
		}

		public override bool Contains(Type type, string key)
		{
			return key == null && Contains(type);
		}

		public override RegistryContext Get(Type type, string key)
		{
			return key == null ? Get(type) : null;
		}

        public override IEnumerable<RegistryContext> GetAll(Type type, string key)
		{
			return null;
		}

		public override bool Register(Type from, RegistryContext context)
		{
			if (context.Key == null)
			{
				Add(from, context);

				return true;
			}

			return false;
		}

        public override bool Register(Type from, string key, IEnumerable<RegistryContext> contexts)
		{
			return false;
		}
	}
}
